<cfsilent>
	<cfscript>
		examBean = Event.getValue("examBean");
		examID = examBean.getExam_ID();
		//var viewMode = Event.getValue("viewMode");	
	</cfscript>
</cfsilent>
<cfoutput>
<script language="javascript" type="text/javascript">
	
	$(document).ready(function(){
		$("a.list").click(function(){
			var theURL = "/index.cfm?event=admin.dspQuestions&isAjax=1&id=#examID#";
			$.get(theURL, function(data){
				$("##questionsContainer").html(data);
			});
		});
	
		$("a.dspAddQuestion").click(function(){
			var theURL = "/index.cfm?event=admin.dspAddEditQuestion&isAjax=1&id=#examID#";
			$.get(theURL, function(data){
				$("##questionsContainer").html(data);
			});
		});
	});

</script>


<h2>Add/Edit Exam</h2>
<cfform action="/index.cfm" method="post">
	<input type="hidden" name="action" value="addedit">
	<input type="hidden" name="event" value="admin.doSaveExam">
	<input type="hidden" name="exam_id" value="#examID#">
	<table cellpadding="5">
		<tr>
			<td><label>Exam Name:</label></td>
			<td><input type="text" name="name" value="#examBean.getName()#"><br /></td>
		</tr>
		<tr>
			<td><label>Exam Description:</label></td>
			<td><textarea name="description" cols="30" rows="5">#examBean.getDescription()#</textarea><br /></td>
		</tr>	
	</table>
	<input type="submit" name="submit" value="submit">
</cfform>
	
<hr />
<h2>Add/Edit This Exam's Questions</h2>
<a href="##" class="list">List questions</a>
<a href="##" class="dspAddQuestion">Add questions to exam</a>

<div id="questionsContainer">
	<!--- loop all questions here --->
	<table cellspacing="0" cellpadding="0" width="100%">
		<tr><th>Question</th><th>Action</th></tr>
		<!--- loop all questions here --->
		<tr>
			<td>What is the question again?</td>
			<td><a href="">Edit</a> | <a href="">Show Answers</a></td>
		</tr>
		<tr>
			<td colspan="2">
				<!--- prepopulated by Ajax from show answers--->
				<div id="answers_question1"></div>
			</td>
		</tr>
		<!--- end loop --->
	</table>
</div>

</cfoutput>